Title: SQL W3S (By-BKK) / 006 Order By
Tags: Obsidian_to_Anki

Q: What does ORDER BY do in SQL?
A: Sorts results in ascending or descending order

Q: True/False: ORDER BY sorts records ascending by default
A: True

Q: How do you sort products by price in SQL?
A: SELECT * FROM Products ORDER BY Price

Q: How do you sort records in descending order?
A: Use ORDER BY column_name DESC

Q: Which SQL keyword sorts alphabetically by ProductName?
A: ORDER BY ProductName

Q: How do you sort names reverse alphabetically?
A: ORDER BY ProductName DESC

Q: How do you sort by multiple columns in SQL?
A: ORDER BY column1, column2

Q: What does this query do: SELECT * FROM Customers ORDER BY Country, CustomerName
A: Sorts customers by country, then by customer name within each country

Q: Can you use both ASC and DESC in the same ORDER BY?
A: Yes

Q: Write a SQL query to sort by Country ascending and CustomerName descending
A: SELECT * FROM Customers ORDER BY Country ASC, CustomerName DESC

Q: Which table is used in W3Schools ORDER BY examples?
A: Products

Q: Sorts results in ascending or descending order
A: What does ORDER BY do in SQL?

Q: True
A: Does ORDER BY sort results ascending by default?

Q: SELECT * FROM Products ORDER BY Price
A: How do you sort products by price in SQL?

Q: ORDER BY ProductName DESC
A: How do you sort names reverse alphabetically?